<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>checkbox</title>
<link rel="stylesheet" type="text/css" href="../../ext3/css/ext-all.css" />
<script type="text/javascript" src="../../ext3/ext-base-debug.js"></script>
<script type="text/javascript" src="../../ext3/ext-all-debug.js"></script>
<script type="text/javascript" src="../../ext3/ext-basex.js"></script>
<script type="text/javascript" src="../../ext3/ext-lang-zh_CN.js"></script>
<script src="../../js/commons/checkBoxFieldSet.js"></script>
</head>
<body>
<script>
var checkBox = new Ext.sw.FieldSetCheckBox({
	id:'fsExt',
	layout:'table',
	fieldLabel:'新闻栏目',
	store:new Ext.data.Store({
					proxy:new Ext.data.HttpProxy({ 
						async: false,//设置同步 
						url:'../../json/news_attrs.json', 
					}), 
					reader:new Ext.data.JsonReader({root:''},[
								{name:'id',mapping:'id'},
								{name:'name',mapping:'name'}
							])
				  }),
	checkId:"id",
	checkName:"name",
	defaults:{bodyStyle:'padding: 200px'},
	layoutConfig:{columns:5},
	subName:"attrs"
});

var formpanel = new Ext.form.FormPanel({
	title:"checkBox",
	frame:true,
	items:[checkBox],
	buttons:[{
		text:'获取选择对象',
		handler:function(){
			var obj = checkBox.getValue();
			var names="";
			for(var i=0;i<obj.length;i++){
				names+=obj[i].boxLabel+" , ";
			}
			Ext.Msg.alert("选中",names);
		}
	},{
		text:'重置(攻略，专题)',
		handler:function(){
			checkBox.setValue([01,02]);
		}
	},{
		text:'重置(清空)',
		handler:function(){
			checkBox.clean();
		}
	},{
		text:'后退',
		handler:function(){
			window.location.href="../../index.html";
		}
	}]
});
		Ext.onReady(function(){
			Ext.QuickTips.init();
			Ext.form.Field.prototype.msgTarget='side';
			var viewport = new Ext.Viewport({
				items:[formpanel]
			});
		});
	</script>
</body>
</html>